package com.sundaying.gooway.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.sundaying.gooway.dao.TopClassDao;
import com.sundaying.gooway.entity.TopClass;

@Component
public class TopClassService {
	private TopClassDao topClassDao;

	public TopClassDao getTopClassDao() {
		return topClassDao;
	}

	@Resource
	public void setTopClassDao(TopClassDao topClassDao) {
		this.topClassDao = topClassDao;
	}

	public int add(TopClass t) {
		int result = 0;
		topClassDao.save(t);
		return result;
	}

	public List<TopClass> list() {
		String hql = "from TopClass topClass";
		return topClassDao.list(hql, null);
	}

	public int update(TopClass t) {
		int result = 0;
		topClassDao.update(t);
		return result;
	}

	public int delete(int id) {
		int result = 0;
		topClassDao.delete(topClassDao.load(id));
		return result;
	}
}
